package br.usp.ime.lab.math;

import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;


public class MenorDosTresTest {

	/**
	 * Classe usada para validar a classe MenorDosTres.
	 */
	
	private MenorDosTres menorDosTres;

	@Before
	public void setUp() {
		menorDosTres = new MenorDosTres();
	}

	@Test
	public void testAMenor() {
		Double a = Math.random();
		Double b = a + 1;
		Double c = b + 1;
		Assert.assertEquals(a, menorDosTres.menor(a, b, c));
	}

	@Test
	public void testBMenor() {
		Double b = Math.random();
		Double a = b + 1;
		Double c = b + 1;
		Assert.assertEquals(b, menorDosTres.menor(a, b, c));
	}

	@Test
	public void testCMenor() {
		Double c = Math.random();
		Double b = c + 1;
		Double a = b + 1;
		Assert.assertEquals(c, menorDosTres.menor(a, b, c));
	}

	@Test
	public void testIguais() throws Exception {
		Double a = Math.random();
		Double b = a;
		Double c = a;
		Assert.assertEquals(a, menorDosTres.menor(a, b, c));
		Assert.assertEquals(b, menorDosTres.menor(a, b, c));
		Assert.assertEquals(c, menorDosTres.menor(a, b, c));
	}
}